package com.dreamsail.service.help;

import org.springframework.integration.mqtt.support.MqttHeaders;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.MessagingException;
import org.springframework.stereotype.Component;

@Component
public class MqttMessageReceiver implements MessageHandler {
    @Override
    public void handleMessage(Message<?> message) throws MessagingException {
        // 获取消息内容
        String messagePayload = (String) message.getPayload();

        MessageHeaders headers =  message.getHeaders();
        // 获取topic
        String receivedTopic = (String) headers.get(MqttHeaders.RECEIVED_TOPIC);

    }
}
